home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmSwitcher
- BackColor = &H00FFFFC0&
- Caption = "Autoload Switcher"
- ClientHeight = 4065
- ClientLeft = 1560
- ClientTop = 1785
- ClientWidth = 5610
- Height = 4755
- Icon = FRMSTART.FRX:0000
- Left = 1500
- LinkTopic = "Form1"
- ScaleHeight = 4065
- ScaleWidth = 5610
- Top = 1155
- Width = 5730
- Begin CommandButton cmdExit
- Caption = "E&xit"
- Height = 495
- Left = 4200
- TabIndex = 8
- Top = 3360
- Width = 1215
- End
- Begin TextBox txtFile
- Height = 285
- Left = 1920
- TabIndex = 12
- Top = 360
- Width = 1935
- End
- Begin ComboBox lstType
- Height = 300
- Left = 120
- Style = 2 'Dropdown List
- TabIndex = 11
- Top = 3000
- Width = 2055
- End
- Begin FileListBox File1
- Height = 2175
- Left = 120
- TabIndex = 10
- Top = 360
- Width = 1575
- End
- Begin CommandButton cmdDel
- Caption = "&Delete"
- Enabled = 0 'False
- Height = 495
- Left = 4200
- TabIndex = 6
- Top = 2520
- Width = 1215
- End
- Begin CommandButton cmdModify
- Caption = "&Modify"
- Enabled = 0 'False
- Height = 495
- Left = 4200
- TabIndex = 5
- Top = 1920
- Width = 1215
- End
- Begin CommandButton cmdNew
- Caption = "&New"
- Enabled = 0 'False
- Height = 495
- Left = 4200
- TabIndex = 4
- Top = 1320
- Width = 1215
- End
- Begin CommandButton cmdSwitch
- Caption = "&Switch"
- Enabled = 0 'False
- Height = 495
- Left = 4200
- TabIndex = 3
- Top = 600
- Width = 1215
- End
- Begin ListBox lstvbx
- Height = 1590
- Left = 1920
- TabIndex = 0
- Top = 960
- Width = 1935
- End
- Begin Label lblAvb
- BackColor = &H00FFFFC0&
- Caption = "lblAvb"
- Height = 255
- Left = 4200
- TabIndex = 16
- Top = 360
- Width = 1455
- End
- Begin Label lblCurAVB
- BackColor = &H00FFFFC0&
- Caption = "Current AVB:"
- Height = 255
- Left = 4200
- TabIndex = 15
- Top = 120
- Width = 1215
- End
- Begin Label lblDisCurDir
- BackColor = &H00FFFFC0&
- Caption = "lblCurPath"
- Height = 255
- Left = 120
- TabIndex = 9
- Top = 3720
- Width = 3735
- End
- Begin Label lblPath
- BackColor = &H00FFFFC0&
- Caption = "Path:"
- Height = 255
- Left = 120
- TabIndex = 14
- Top = 3480
- Width = 1095
- End
- Begin Label txtavbFile
- BackColor = &H00FFFFC0&
- Caption = "Autolad &File"
- Height = 255
- Left = 1920
- TabIndex = 13
- Top = 120
- Width = 1215
- End
- Begin Label lblFileType
- BackColor = &H00FFFFC0&
- Caption = "File &Type"
- Height = 255
- Left = 120
- TabIndex = 7
- Top = 2760
- Width = 1215
- End
- Begin Label lblVBXlist
- BackColor = &H00FFFFC0&
- Caption = "&List of VBX's"
- Height = 255
- Left = 1920
- TabIndex = 2
- Top = 720
- Width = 1575
- End
- Begin Label lblVbxFiles
- BackColor = &H00FFFFC0&
- Caption = "VB&X Autoload Files"
- Height = 255
- Left = 120
- TabIndex = 1
- Top = 120
- Width = 1935
- End
- Begin Menu mnuFile
- Caption = "&File"
- Begin Menu mnuFileItem
- Caption = "&New"
- Enabled = 0 'False
- Index = 0
- End
- Begin Menu mnuFileItem
- Caption = "&Modify"
- Enabled = 0 'False
- Index = 1
- End
- Begin Menu mnuFileItem
- Caption = "&Delete"
- Enabled = 0 'False
- Index = 2
- End
- Begin Menu mnuFileItem
- Caption = "-"
- Index = 3
- End
- Begin Menu mnuFileItem
- Caption = "E&xit"
- Index = 4
- End
- End
- Begin Menu mnuOption
- Caption = "&Options"
- Begin Menu mnuSwitch
- Caption = "&Switch"
- Enabled = 0 'False
- End
- Begin Menu mnuChangeDir
- Caption = "&Change Dir"
- End
- End
- Option Explicit
- Sub buttonsOFF ()
- cmdSwitch.Enabled = False
- cmdModify.Enabled = False
- cmdDel.Enabled = False
- mnuFileItem(1).Enabled = False
- mnuFileItem(2).Enabled = False
- mnuSwitch.Enabled = False
- End Sub
- Sub buttonsOn ()
- cmdSwitch.Enabled = True
- cmdModify.Enabled = True
- cmdDel.Enabled = True
- mnuFileItem(1).Enabled = True
- mnuFileItem(2).Enabled = True
- mnuSwitch.Enabled = True
- End Sub
- Sub cmdDel_click ()
- Dim rs As Integer
- Dim Path As String
- If file1.ListIndex = -1 Then
- MsgBox "You must first select a AVB file to delete."
- Exit Sub
- End If
- If UCase$(Trim$(Right$(file1.FileName, 3))) = "AVB" Then
- rs = MsgBox("Delete the file " & UCase$(file1.FileName), MB_YESNO, "Delete")
- Select Case rs
- Case IDYes
- Path = convpath(CStr(lblDisCurDir.Caption))
- Kill Path & file1.FileName
- file1.Refresh
- txtFile.Text = ""
- End Select
- MsgBox "This program can only delete AVB files."
- End If
- buttonsOFF
- End Sub
- Sub cmdExit_Click ()
- Unload Me
- End
- End Sub
- Sub cmdModify_click ()
- Dim cnt As Integer
- Load frmmain
- For cnt = 1 To filelinecount
- frmmain.lstVBX.AddItem vbxfiledata(cnt).linedata
- frmmain.Caption = txtFile.Text
- curmodfile = txtFile.Text
- frmmain.Show
- End Sub
- Sub cmdNew_click ()
- Dim rs As Integer
- Dim cnt As Integer
- rs = filllist(tempAVB, avbdir)
- Load frmmain
- frmmain.lstVBX.Clear
- For cnt = 1 To filelinecount
- frmmain.lstVBX.AddItem vbxfiledata(cnt).linedata
- frmmain.Caption = "*.AVB"
- frmmain.Show
- End Sub
- Sub cmdSwitch_Click ()
- Dim filepath As String
- Dim rs As Integer
- filepath = convpath(CStr(lblDisCurDir.Caption))
- rs = MsgBox(UCase$(txtFile.Text) & " will become the new AUTOLOAD.MAK file.", MB_OKCANCEL, "Switch")
- If rs = IDOK Then
- FileCopy filepath & txtFile.Text, "c:\vb\autoload.mak"
- lblavb.Caption = UCase$(txtFile.Text)
- End If
- End Sub
- Sub File1_Click ()
- Dim rs As Integer
- Dim avbfname As String
- Dim avbfpath As String
- If file1.ListIndex = -1 Then
- buttonsOFF
- Exit Sub
- End If
- avbfname = file1.FileName
- avbfpath = file1.Path
- txtFile.Text = file1.FileName
- rs = filllist(avbfname, avbfpath)
- buttonsOn
- End Sub
- Sub Form_Activate ()
- file1.Refresh
- file1.Path = avbdir
- lblDisCurDir.Caption = avbdir
- End Sub
- Sub Form_Load ()
- lstType.AddItem "AutoSwitch (*.AVB)"
- lstType.AddItem "All (*.*)"
- lstType.ListIndex = 0
- GetINI
- dftDir = GetDefaultDir
- lblavb.Caption = GetCurAvb
- avbdir = dftDir
- tempAVB = "TEMPLATE.AVB"
- Set thelist = lstVBX
- End Sub
- Sub Form_Unload (Cancel As Integer)
- Call WriteDefaults
- End Sub
- Sub GetINI ()
- Dim rc As Integer
- Dim keyvalue As String, keydefault As String, keyname As String
- Dim sectionname As String, FileName As String
- Dim CurAvb As String
- FileName = "AutoSwVB.INI"
- sectionname = "Settings"
- keyname = "Dir"
- keydefault = CurDir
- keyvalue = String$(16, 0)
- rc = GetPrivateProfileString(sectionname, keyname, keydefault, keyvalue, Len(keyvalue), FileName)
- GetDefaultDir = Left$(keyvalue, rc)
- keyname = "FILE"
- CurAvb = "Autoload.mak"
- keyvalue = String$(16, 0)
- rc = GetPrivateProfileString(sectionname, keyname, CurAvb, keyvalue, Len(keyvalue), FileName)
- GetCurAvb = UCase$(Left$(keyvalue, rc))
- End Sub
- Sub lstType_Click ()
- Dim newpattern As String
- Dim stpos As Integer
- Dim Endpos As Integer
- newpattern = lstType.Text
- stpos = InStr(1, newpattern, "(")
- Endpos = InStr(1, newpattern, ")")
- newpattern = Mid(newpattern, stpos + 1, Endpos - stpos - 1)
- file1.Pattern = newpattern
- End Sub
- Sub mnuChangeDir_Click ()
- frmChDir.Show 1
- End Sub
- Sub mnuFileItem_Click (Index As Integer)
- Select Case Index
- Case 0 'File New
- cmdNew_click
- Case 1 'File Modify
- cmdModify_click
- Case 2 'File Delete
- cmdDel_click
- Case 4 'File Exit
- Unload Me
- End
- End Select
- End Sub
- Sub txtFile_Change ()
- If Len(txtFile.Text) = 0 Then
- buttonsOFF
- lstVBX.Clear
- file1.ListIndex = -1
- buttonsOn
- End If
- End Sub
- Sub WriteDefaults ()
- Dim rc As Integer
- Dim keyname As String
- Dim keyvalue As String
- Dim sectionname As String, FileName As String
- FileName = "AutoSwVB.INI"
- sectionname = "Settings"
- keyname = "DIR"
- keyvalue = dftDir
- rc = WritePrivateProfileString(sectionname, ByVal keyname, ByVal keyvalue, FileName)
- keyname = "FILE"
- keyvalue = lblavb.Caption
- rc = WritePrivateProfileString(sectionname, ByVal keyname, ByVal keyvalue, FileName)
- End Sub
-